package servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.HomeDAO;


@WebServlet("/servlet/HomeServlet")
public class HomeServlet extends HttpServlet{
	private HomeDAO dao = new HomeDAO();
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        	Home_add(request);
      	request.getRequestDispatcher("/home.jsp").forward(request, response);   	
    }
    private void Home_add(HttpServletRequest request) {
      	 try {
      		 this.dao.addHome();

   	 } catch (Exception ex) {
   		 
            request.setAttribute("errormsg", ex.getMessage());
            
        }
    }
}
